.class public final Lcom/wqmobile/sdk/protocol/b/b;
.super Ljava/lang/Object;

# interfaces
.implements Lcom/wqmobile/sdk/protocol/b/a;


# static fields
.field private static a:Lcom/wqmobile/sdk/protocol/b/b;


# instance fields
.field private b:Ljava/net/Socket;

.field private c:Ljava/net/InetAddress;

.field private d:I


# direct methods
.method private constructor <init>(Ljava/net/InetAddress;I)V
    .locals 3

    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    iput-object p1, p0, Lcom/wqmobile/sdk/protocol/b/b;->c:Ljava/net/InetAddress;

    iput p2, p0, Lcom/wqmobile/sdk/protocol/b/b;->d:I

    new-instance v0, Ljava/net/Socket;

    iget-object v1, p0, Lcom/wqmobile/sdk/protocol/b/b;->c:Ljava/net/InetAddress;

    iget v2, p0, Lcom/wqmobile/sdk/protocol/b/b;->d:I

    invoke-direct {v0, v1, v2}, Ljava/net/Socket;-><init>(Ljava/net/InetAddress;I)V

    iput-object v0, p0, Lcom/wqmobile/sdk/protocol/b/b;->b:Ljava/net/Socket;

    return-void
.end method

.method public static a(Ljava/net/InetAddress;I)Lcom/wqmobile/sdk/protocol/b/a;
    .locals 1

    sget-object v0, Lcom/wqmobile/sdk/protocol/b/b;->a:Lcom/wqmobile/sdk/protocol/b/b;

    if-nez v0, :cond_0

    new-instance v0, Lcom/wqmobile/sdk/protocol/b/b;

    invoke-direct {v0, p0, p1}, Lcom/wqmobile/sdk/protocol/b/b;-><init>(Ljava/net/InetAddress;I)V

    sput-object v0, Lcom/wqmobile/sdk/protocol/b/b;->a:Lcom/wqmobile/sdk/protocol/b/b;

    :cond_0
    sget-object v0, Lcom/wqmobile/sdk/protocol/b/b;->a:Lcom/wqmobile/sdk/protocol/b/b;

    return-object v0
.end method


# virtual methods
.method public final a([B)V
    .locals 2

    iget-object v0, p0, Lcom/wqmobile/sdk/protocol/b/b;->b:Ljava/net/Socket;

    if-eqz v0, :cond_0

    iget-object v0, p0, Lcom/wqmobile/sdk/protocol/b/b;->b:Ljava/net/Socket;

    invoke-virtual {v0}, Ljava/net/Socket;->getOutputStream()Ljava/io/OutputStream;

    move-result-object v0

    invoke-virtual {v0, p1}, Ljava/io/OutputStream;->write([B)V

    invoke-virtual {v0}, Ljava/io/OutputStream;->flush()V

    return-void

    :cond_0
    new-instance v0, Ljava/lang/NullPointerException;

    const-string v1, "Null socket."

    invoke-direct {v0, v1}, Ljava/lang/NullPointerException;-><init>(Ljava/lang/String;)V

    throw v0
.end method

.method public final b([B)V
    .locals 2

    array-length v0, p1

    if-gtz v0, :cond_0

    :goto_0
    return-void

    :cond_0
    iget-object v0, p0, Lcom/wqmobile/sdk/protocol/b/b;->b:Ljava/net/Socket;

    if-eqz v0, :cond_1

    iget-object v0, p0, Lcom/wqmobile/sdk/protocol/b/b;->b:Ljava/net/Socket;

    invoke-virtual {v0}, Ljava/net/Socket;->getInputStream()Ljava/io/InputStream;

    move-result-object v0

    invoke-virtual {v0, p1}, Ljava/io/InputStream;->read([B)I

    goto :goto_0

    :cond_1
    new-instance v0, Ljava/lang/NullPointerException;

    const-string v1, "Null socket."

    invoke-direct {v0, v1}, Ljava/lang/NullPointerException;-><init>(Ljava/lang/String;)V

    throw v0
.end method

.method protected final finalize()V
    .locals 1

    iget-object v0, p0, Lcom/wqmobile/sdk/protocol/b/b;->b:Ljava/net/Socket;

    if-eqz v0, :cond_0

    :try_start_0
    iget-object v0, p0, Lcom/wqmobile/sdk/protocol/b/b;->b:Ljava/net/Socket;

    invoke-virtual {v0}, Ljava/net/Socket;->close()V
    :try_end_0
    .catch Ljava/io/IOException; {:try_start_0 .. :try_end_0} :catch_0

    :cond_0
    :goto_0
    return-void

    :catch_0
    move-exception v0

    invoke-static {v0}, Lcom/wqmobile/sdk/protocol/cmd/b;->a(Ljava/lang/Exception;)V

    goto :goto_0
.end method
